<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>快捷跑腿 - 我的消息</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://code.iconify.design/3/3.1.1/iconify.min.js"></script>
    <style>
        /* 全局样式：与首页/订单页保持一致 */
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
        }

        body {
            background-color: #f3f4f6;
            color: #4b5563;
            padding-bottom: 70px; /* 为底部导航留空间 */
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }

        .page-container {
            display: none;
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            padding: 24px;
            margin-bottom: 24px;
        }

        /* 默认显示消息页面 */
        #message-page {
            display: block;
        }

        .section-title {
            font-size: 20px;
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 16px;
        }

        /* 顶部导航栏：返回+标题 */
        .top-nav {
            display: flex;
            align-items: center;
            gap: 16px;
            margin-bottom: 24px;
        }

        .back-btn {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background-color: #f0f9ff;
            color: #3b82f6;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
        }

        .back-btn:hover {
            background-color: #dbeafe;
        }

        .top-nav-title {
            font-size: 22px;
            font-weight: 600;
            color: #1f2937;
        }

        /* 消息分类标签栏 */
        .message-tabs {
            display: flex;
            border-bottom: 1px solid #e5e7eb;
            margin-bottom: 20px;
        }

        .tab-item {
            padding: 12px 0;
            margin-right: 24px;
            font-size: 15px;
            font-weight: 500;
            color: #6b7280;
            cursor: pointer;
            position: relative;
            transition: all 0.2s;
        }

        .tab-item.active {
            color: #3b82f6;
        }

        /* 激活态下划线 */
        .tab-item.active::after {
            content: '';
            position: absolute;
            bottom: -1px;
            left: 0;
            width: 100%;
            height: 2px;
            background-color: #3b82f6;
            border-radius: 2px;
        }

        .tab-item:hover:not(.active) {
            color: #3b82f6;
            opacity: 0.8;
        }

        /* 消息列表样式 */
        .message-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        /* 消息卡片：核心样式与订单卡片统一感 */
        .message-card {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 16px;
            background-color: white;
            border-radius: 12px;
            border: 1px solid #e5e7eb;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .message-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
            border-color: #dbeafe;
        }

        /* 未读消息卡片特殊样式 */
        .message-card.unread {
            border-left: 4px solid #3b82f6;
            background-color: #f9fbff;
        }

        /* 消息头像 */
        .message-avatar {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            object-fit: cover;
            flex-shrink: 0;
            background-color: #f0f9ff;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #3b82f6;
        }

        .avatar-icon {
            font-size: 24px;
        }

        /* 消息内容区域 */
        .message-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .message-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .sender-name {
            font-size: 15px;
            font-weight: 600;
            color: #1f2937;
        }

        .message-time {
            font-size: 12px;
            color: #9ca3af;
        }

        .message-text {
            font-size: 14px;
            color: #4b5563;
            display: -webkit-box;
            -webkit-line-clamp: 1; /* 只显示1行，超出省略 */
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        /* 未读提示点 */
        .unread-badge {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: #3b82f6;
            margin-left: 8px;
        }

        /* 系统消息特殊样式 */
        .system-message .message-text {
            color: #6b7280;
        }

        /* 按钮样式：与全局统一 */
        .btn-primary {
            background-color: #3b82f6;
            color: white;
            height: 44px;
            padding: 0 32px;
            border-radius: 8px;
            border: none;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
        }

        .btn-primary:hover {
            background-color: #2563eb;
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
        }

        /* 底部导航：与首页/订单页完全一致 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 12px 0 8px;
            background: white;
            border-top: 1px solid #e5e7eb;
            display: flex;
            justify-content: space-around;
            z-index: 100;
            box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        }

        .nav-link {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-decoration: none;
            color: #9ca3af;
            font-size: 12px;
            padding: 4px 12px;
            border-radius: 8px;
            transition: all 0.2s;
        }

        .nav-link:hover, .nav-link.active {
            color: #3b82f6;
            background-color: #f0f9ff;
        }

        /* 响应式适配 */
        @media (max-width: 768px) {
            .container {
                padding: 15px;
            }

            .page-container {
                padding: 16px;
            }

            .top-nav-title {
                font-size: 20px;
            }

            .tab-item {
                margin-right: 16px;
                font-size: 14px;
            }

            .message-card {
                padding: 14px;
                gap: 10px;
            }

            .message-avatar {
                width: 42px;
                height: 42px;
            }

            .sender-name {
                font-size: 14px;
            }

            .message-text {
                font-size: 13px;
            }
        }

        @media (max-width: 480px) {
            .section-title {
                font-size: 18px;
            }

            .tab-item {
                margin-right: 12px;
                font-size: 13px;
            }

            .message-time {
                font-size: 11px;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <!-- 消息页面 -->
    <div id="message-page" class="page-container">
        <!-- 顶部导航：返回+标题 -->
        <div class="top-nav">
            <div class="back-btn" id="back-to-home">
                <span class="iconify" data-icon="mdi:chevron-left"></span>
            </div>
            <h1 class="top-nav-title">我的消息</h1>
        </div>

        <!-- 消息分类标签 -->
        <div class="message-tabs">
            <div class="tab-item active" data-tab="all">全部消息</div>
            <div class="tab-item" data-tab="order">订单消息</div>
            <div class="tab-item" data-tab="system">系统通知</div>
            <div class="tab-item" data-tab="chat">客户沟通</div>
        </div>

        <!-- 消息列表 -->
        <div class="message-list">
            <!-- 1. 客户沟通消息（未读） -->
            <div class="message-card unread" data-type="chat">
                <div class="message-avatar">
                    <span class="avatar-icon iconify" data-icon="mdi:account-circle"></span>
                </div>
                <div class="message-content">
                    <div class="message-header">
                        <div class="flex items-center">
                            <span class="sender-name">李女士</span>
                            <span class="unread-badge"></span>
                        </div>
                        <span class="message-time">10:23</span>
                    </div>
                    <p class="message-text">我的代取件订单大概什么时候能到呀？麻烦尽快~</p>
                </div>
            </div>

            <!-- 2. 订单消息（未读） -->
            <div class="message-card unread" data-type="order">
                <div class="message-avatar">
                    <span class="avatar-icon iconify" data-icon="mdi:clipboard-list"></span>
                </div>
                <div class="message-content">
                    <div class="message-header">
                        <div class="flex items-center">
                            <span class="sender-name">订单系统</span>
                            <span class="unread-badge"></span>
                        </div>
                        <span class="message-time">09:45</span>
                    </div>
                    <p class="message-text">您接的「代购物（盒马鲜生）」订单，客户已确认发货，请注意查收取货码</p>
                </div>
            </div>

            <!-- 3. 系统通知 -->
            <div class="message-card system-message" data-type="system">
                <div class="message-avatar">
                    <span class="avatar-icon iconify" data-icon="mdi:bell-ring"></span>
                </div>
                <div class="message-content">
                    <div class="message-header">
                        <span class="sender-name">系统通知</span>
                        <span class="message-time">昨天 18:30</span>
                    </div>
                    <p class="message-text">【福利活动】今日完成3单跑腿订单，可额外获得15元现金奖励，点击查看详情</p>
                </div>
            </div>

            <!-- 4. 客户沟通消息 -->
            <div class="message-card" data-type="chat">
                <div class="message-avatar">
                    <span class="avatar-icon iconify" data-icon="mdi:account-circle"></span>
                </div>
                <div class="message-content">
                    <div class="message-header">
                        <span class="sender-name">张先生</span>
                        <span class="message-time">昨天 15:12</span>
                    </div>
                    <p class="message-text">麻烦帮我带的奶茶要少糖少冰，谢谢啦~</p>
                </div>
            </div>

            <!-- 5. 订单消息 -->
            <div class="message-card" data-type="order">
                <div class="message-avatar">
                    <span class="avatar-icon iconify" data-icon="mdi:clipboard-list"></span>
                </div>
                <div class="message-content">
                    <div class="message-header">
                        <span class="sender-name">订单系统</span>
                        <span class="message-time">昨天 10:08</span>
                    </div>
                    <p class="message-text">您发布的「陪诊服务（浙江省人民医院）」订单已被骑手接单，骑手：王师傅（138****5678）</p>
                </div>
            </div>

            <!-- 6. 系统通知 -->
            <div class="message-card system-message" data-type="system">
                <div class="message-avatar">
                    <span class="avatar-icon iconify" data-icon="mdi:bell-ring"></span>
                </div>
                <div class="message-content">
                    <div class="message-header">
                        <span class="sender-name">系统通知</span>
                        <span class="message-time">3天前</span>
                    </div>
                    <p class="message-text">您的账号已完成实名认证，可解锁所有跑腿服务权限，快去接单吧！</p>
                </div>
            </div>

            <!-- 7. 客户沟通消息 -->
            <div class="message-card" data-type="chat">
                <div class="message-avatar">
                    <span class="avatar-icon iconify" data-icon="mdi:account-circle"></span>
                </div>
                <div class="message-content">
                    <div class="message-header">
                        <span class="sender-name">陈女士</span>
                        <span class="message-time">3天前</span>
                    </div>
                    <p class="message-text">取件地址我写错了，应该是XX小区2号楼，不是1号楼，抱歉~</p>
                </div>
            </div>

            <!-- 8. 订单消息 -->
            <div class="message-card" data-type="order">
                <div class="message-avatar">
                    <span class="avatar-icon iconify" data-icon="mdi:clipboard-list"></span>
                </div>
                <div class="message-content">
                    <div class="message-header">
                        <span class="sender-name">订单系统</span>
                        <span class="message-time">3天前</span>
                    </div>
                    <p class="message-text">您的「代送达（星巴克）」订单已完成，客户已确认收货，收入￥22已到账</p>
                </div>
            </div>
        </div>
    </div>

    <!-- 其他页面：保持结构一致，确保导航切换正常 -->
    <div id="home-page" class="page-container">
        <p>首页（点击底部导航可切换）</p>
    </div>

    <div id="order-hall" class="page-container">
        <p>订单大厅（点击底部导航可切换）</p>
    </div>

    <div id="me-page" class="page-container">
        <p>我的页面（点击底部导航可切换）</p>
    </div>
</div>

<!-- 底部导航栏：与全局保持一致 -->
<div class="bottom-nav">
    <a href="./index.html" class="nav-link">
        <span class="iconify text-xl" data-icon="mdi:home-outline"></span>
        <span>首页</span>
    </a>
    <a href="./order.html" class="nav-link">
        <span class="iconify text-xl" data-icon="mdi:clipboard-list-outline"></span>
        <span>订单</span>
    </a>
    <a href="./message.html" class="nav-link active">
        <span class="iconify text-xl" data-icon="mdi:message-outline"></span>
        <span>消息</span>
    </a>
    <a href="./me.html" class="nav-link">
        <span class="iconify text-xl" data-icon="mdi:account-outline"></span>
        <span>我的</span>
    </a>
</div>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        const pages = document.querySelectorAll('.page-container');
        const navLinks = document.querySelectorAll('.nav-link');
        const tabItems = document.querySelectorAll('.tab-item');
        const messageCards = document.querySelectorAll('.message-card');
        const backBtn = document.getElementById('back-to-home');

        // 1. 底部导航切换页面
        navLinks.forEach(link => {
            link.addEventListener('click', function(e) {
                e.preventDefault();
                const targetId = this.getAttribute('data-target');

                // 隐藏所有页面
                pages.forEach(page => {
                    page.style.display = 'none';
                });

                // 显示目标页面
                if (targetId) {
                    document.getElementById(targetId).style.display = 'block';
                }

                // 更新导航激活状态
                navLinks.forEach(nav => {
                    nav.classList.remove('active');
                });
                this.classList.add('active');
            });
        });

        // 2. 消息分类标签切换
        tabItems.forEach(tab => {
            tab.addEventListener('click', function() {
                const tabType = this.getAttribute('data-tab');

                // 更新标签激活状态
                tabItems.forEach(item => {
                    item.classList.remove('active');
                });
                this.classList.add('active');

                // 筛选消息卡片（按类型显示/隐藏）
                messageCards.forEach(card => {
                    const cardType = card.getAttribute('data-type');
                    if (tabType === 'all' || cardType === tabType) {
                        card.style.display = 'flex';
                    } else {
                        card.style.display = 'none';
                    }
                });
            });
        });

        // 3. 点击消息卡片进入详情（模拟）
        messageCards.forEach(card => {
            card.addEventListener('click', function() {
                // 标记未读消息为已读
                this.classList.remove('unread');
                this.querySelector('.unread-badge')?.remove();

                // 实际项目中可跳转至消息详情页，此处用弹窗模拟
                const sender = this.querySelector('.sender-name').textContent;
                const content = this.querySelector('.message-text').textContent;
                alert(`与【${sender}】的对话

最新消息：${content}

（实际场景中会进入聊天详情页）`);
            });
        });

        // 4. 返回按钮：回到首页
        backBtn.addEventListener('click', function() {
            // 隐藏消息页，显示首页
            pages.forEach(page => {
                page.style.display = 'none';
            });
            document.getElementById('home-page').style.display = 'block';

            // 更新导航激活状态（切换到首页）
            navLinks.forEach(nav => {
                nav.classList.remove('active');
            });
            document.querySelector('[data-target="home-page"]').classList.add('active');
        });
    });
</script>
</body>
</html>